<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8"/>
    <title>优化报告</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            padding: 20px;
            line-height: 1.6;
        }

        h2 {
            color: #333;
            border-bottom: 2px solid #ccc;
            padding-bottom: 5px;
        }

        .summary {
            padding: 20px;
        }

        .summary-header {
            font-size: 16px;
            font-weight: bold;
            color: #333333;
            margin-bottom: 20px;
        }

        .summary-brief table {
            width: 100%;
            border-collapse: collapse;
        }

        .summary-brief td {
            width: 33%;
            font-size: 14px;
            color: #333333;
        }

        .table-section {
            margin-top: 3px;
        }

        .table-header {
            font-size: 14px;
            color: #333333;
            margin-bottom: 2px;
        }

        .plans {
            width: 100%;
            margin-top: 10px;
        }

        .plan-item {
            padding: 0 10px;
            margin-bottom: 8px;
        }
        .plan-item td {
            border-bottom: 0.5px solid #ccc;
        }
        .footer {
            text-align: center;
            font-size: 12px;
            color: #999999;
        }

        .header-info {
            text-align: center;
            font-size: 14px;
            color: #666666;
        }

        .header-title {
            font-size: 18px;
            font-weight: bold;
            color: #333333;
            margin: 10px 0;
        }
    </style>
</head>
<body>
<!-- 新增网站信息 -->
<div class="header-info">
    <div class="header-title">省料侠优化报告</div>
</div>
<div class="summary">
    <div class="summary-brief">
        <table>
            <tr>
                <td>原材料总数：<strong th:text="${res.material.size()}"></strong></td>
                <td>损耗统计：<strong th:text="${#numbers.formatDecimal(res.loss, 0, 'POINT', 0, 'COMMA')}"></strong></td>
                <td>总体利用率：<strong th:text="${#numbers.formatDecimal(res.fitness * 100, 2, 'POINT', 0, 'COMMA')} + '%'"></strong></td>
            </tr>
        </table>
    </div>

    <div class="table-section">
        <div class="table-header">原料规格：
            <span th:each="entry : ${res.materialLengthToCount}"
                  th:text="${entry.key} +' × ' + ${entry.value}+'&nbsp;&nbsp;'"> </span>
        </div>
    </div>

    <div class="table-section">
        <div class="table-header">下料规格：
            <span th:each="entry : ${res.partLengthToCount}"
                  th:text="${entry.key} + ' × ' + ${entry.value}+'&nbsp;&nbsp;'"></span>
        </div>
    </div>

    <div class="plans">
        <div th:each="material, iterStat : ${res.material}" class="plan-item">
            <table width="100%">
                <tr>
                    <td align="left" style="width: 70%;">
                        <span th:text="${iterStat.index + 1}+'、'"></span>
                        <span th:each="part : ${material.parts}"
                              th:text="${part.mark + ')' + part.length + 'x' + part.count} + '  '">
                        </span>
                    </td>
                    <td align="right" style="width: 30%;">
                        需要<span th:text="${material.length}"/>材料 <span th:text="${material.count}"/>根 余<span th:text="${material.remaining}"/>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</div>
<!-- 底部信息 -->
<div class="footer">
    <p>© 2025 省料侠版权所有</p>
    <p>本报告由「省料侠」智能生成，请访问官网 www.shengliaoxia.top 获取更多信息。</p>
</div>
</body>
</html>
